import React from "react"
import { useNavigate } from "react-router-dom"
// withRouter 加工一般组件成为路由组件 因为一般组件无法使用 history

function About() {
  const navigate = useNavigate()

  function gos(i) {
    console.log(i)
    // this.props.history.go(1)
    navigate(i)

    // navigate("/home", {
    //   replace: false,
    //   state: {
    //     id: 12323,
    //   },
    // })
  }

  return (
    <>
      <div>About</div>
      <button onClick={() => gos(-1)}>回退</button>
      <button onClick={() => gos(1)}>前进</button>
    </>
  )
}

// export default withRouter(About)
export default About
